package redisinit

import (
	"api/appconfig"

	"context"
	"github.com/go-redis/redis/v8"
	"github.com/zeromicro/go-zero/core/logx"
)

var Rdb *redis.Client

func ExampleClient() {
	data := appconfig.Conf.Redis
	Rdb = redis.NewClient(&redis.Options{
		Addr:     data.Addr,
		Password: data.Password, // no password set
		DB:       data.DB,       // use default DB
	})
	result, err := Rdb.Ping(context.Background()).Result()
	logx.Info(result)
	if err != nil {
		panic(err)
	}
	logx.Info("redis success")

}
